Exchange API
Asset Documentation
The asset documentation is a way to document the release for an asset version. And also can be used to describe the overview of the asset and whatever more the owner wants to add.
The documentation of an asset can have pages and for each page content that describes each section. The default page is the home
.
The content that is added to a page is added as markdown format
.
Note: page content images will be eventually available in the Exchange API v2
Steps to add asset documentation
The steps to add the documentation are the following:
- Create pages in the documentation
draft
(these pages only will be visible indraft mode
, that means, only users with contributor or admin permissions can see the content inside the draft mode, and it wonβt be visible for the rest of the users until the documentation is published)
Add content to the pages in the documentation
draft
Publish the documentation
draft
(now the asset documentation is visible)
Following, there are some examples of how to edit the content of an asset documentation and publish it.
Before executing the examples, read the Anypoint Platform Token
section to know how to obtain the token to be used in the examples. This should be replaced for the value ANYPOINT_TOKEN
in each curl example.
The examples have been made by cURL, but optionally, instead of sending HTTP commands with cURL, you can use Postman or another application.
Consider that the URL parameters that have to be replaced:
:groupId
: Group ID of the asset to be edited
:assetId
: Asset ID of the asset to be edited
:version
: Version of the asset to be edited
How to create a new page in the asset documentation
To create a new page in the asset documentation draft for an asset, this example could be followed.
The page will be added as a draft until the public portal is published. In this case, the new page to be created is newPage
(it is indicated after the -d
flag as pagePath
):
curl -X POST https://anypoint.mulesoft.com/exchange/api/v1/assets/:groupId/:assetId/:version/draft/pages \
-H 'Authorization: bearer ANYPOINT_TOKEN' \
-H 'Content-Type: application/json' \
-d '{ "pagePath": "newPage" }'
Note: There exists an especial pagePath
for API assets that is used to add Terms & Conditions
. To add this page, a new page with pagePath .terms
should be created.
How to upload content for a page
To override the markdown content of the page :pageId
that has been created before for a particular asset, this example could be followed. The content will be added as a draft until the asset documentation is published.
The markdown content is specified after the -d
flag. In this example, it is markdown *content* for this page
.
curl -X PUT https://anypoint.mulesoft.com/exchange/api/v1/assets/:groupId/:assetId/:version/draft/pages/:pageId \
-H 'Authorization: bearer ANYPOINT_TOKEN' \
-H 'Content-Type: text/markdown' \
-d 'markdown *content* for this page'
How to publish the draft asset documentation
Use this example to publish the content of the asset documentation that is in the draft mode. Once it is published, all the asset documentation will be available.
curl -X PATCH https://anypoint.mulesoft.com/exchange/api/v1/assets/:groupId/:assetId/:version \
-H 'Authorization: bearer ANYPOINT_TOKEN'